<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <h1 ref="h1ele">这是H1</h1>
    <hello ref="ho"></hello>
    <button @click="getref">获取h1元素</button>
</div>
<script src="vue.js"></script>
<script>
    Vue.component('hello',{
       template:`<p>hello 组件</p>`,
        data(){
           return{
               msg:'这是hello组件中的msg属性'
           }
        },
        methods:{
            test(){
            }
        }
    });
    var vm = new Vue({
        el: '#app',
        data: {

        },
        methods:{
            getref(){
                console.log(this.$refs.ho.msg);
            }
        }
    })
</script>
</body>
</html>